<!doctype html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8" />
    <title>快速初始化-显示加载的图片</title>
    <script src="//cdn.jsdelivr.net/npm/phaser@3.11.0/dist/phaser.js"></script>
    <style type="text/css">
        body {
            margin: 0;
        }
    </style>
</head>
<body>

<script type="text/javascript">

	var config = {
		type: Phaser.AUTO,
		width: 800,
		height: 600,
		physics: {
			default: 'arcade',
			arcade: {
				gravity: { y: 0 },
				debug: false
			}
		},
		scene: {
			preload: preload,
			create: create,
			update: update
		}
	};
	//初始化
	var game = new Phaser.Game(config);
	var player;

	//预加载图片或者资源
    function preload ()
    {
		this.load.image('sky', './assets/sky.png');
		this.load.image('monkey','./assets/monkey.png');
    }

	//显示预加载的资源或者图片
    function create ()
    {
		player=this.physics.add.sprite(400,580,"monkey");
		var tween = this.tweens.add({
			targets: player,
			y: 600,
			ease: 'Power1',
			duration: 1000,
			yoyo: true,
			repeat: 10000,
			onStart: function () { console.log('onStart'); console.log(arguments); },
			onComplete: function () { console.log('onComplete'); console.log(arguments); },
			onYoyo: function () { console.log('onYoyo'); console.log(arguments); },
			onRepeat: function () { console.log('onRepeat'); console.log(arguments); },
		});
	}
    function update (time, delta)
    {


    }

</script>

</body>
</html>